import {
  setStorageToken,
  removeStorageToken,
  getStorageToken
} from '@/utils/storage'
const state = {
  // 保存登录成功的token信息
  token: getStorageToken()
}

const mutations = {
  setToken(state, payload) {
    state.token = payload
    setStorageToken(payload)
  },
  removeToken(state) {
    state.token = {}
    removeStorageToken()
  }
}

const actions = {}
const getters = {}

export default {
  state,
  mutations,
  getters,
  actions,
  // 开启命名空间
  namespaced: true
}
